/*
by txdnet.cn tonydon
 */

package txdnet.util.uploader.apache.fileupload;
import org.apache.commons.fileupload.FileItem;
import txdnet.util.FileUtil;
import txdnet.util.Logger;
import txdnet.util.StaticMark;
import txdnet.util.image.ImageUtil;
/**
 *
 * @author txdnet
 */
public class UploadImageFilter implements UploadFileFilter{
   public UploadImageFilter(){}
    @Override
   public boolean check(FileItem item){
        boolean flag ;
        try{ // 
            flag = (StaticMark.UPLOAD_IMG_TYPE.contains(FileUtil.getFileExt(item.getName())) && ImageUtil.checkImage(item) );
        }catch(Exception e){
            Logger.error(UploadImageFilter.class, e.toString());
            flag = false;
        }
      return flag;
   }
}